Skip to content

Experimental option to transcode surround sound audio to AC3#947

Merged
damontecres merged 13 commits into
mainfrom
develop/ac3-test
Jul 9, 2026
Merged

Experimental option to transcode surround sound audio to AC3#947
damontecres merged 13 commits into
mainfrom
develop/ac3-test

Conversation

@damontecres

@damontecres damontecres commented Feb 21, 2026

Copy link
Copy Markdown
Owner

Description

Adds an experimental setting to prefer transcoding audio with more than 2 channels to AC3. Stereo audio does not transcode.

This is basically a workaround for HDMI ARC (not eARC) or optical audio devices because instead of 2 uncompressed PCM channels, 6 AC3 channels (ie 5.1) is possible.

An downside of enabling this is that embedded subtitles be burned in causing a video transcode as well.

Related issues

Fixes #255
Incorporates some code from #1410

Testing

Just on the emulator so far to observe if the settings trigger the transcode or not

Screenshots

N/A

AI or LLM usage

None

@damontecres damontecres added enhancement New feature or request playback Related to media playback labels Feb 21, 2026
@n8llcaster

n8llcaster commented Feb 25, 2026

Copy link
Copy Markdown

Merged this to 0.5.1 release and tested on Yamaha ARC receiver + Sony Android TV.

When playing AAC 5.1 it will convert it to AC3 5.1 and play beautifully on receiver as it should, but there are downsides as you mentioned.

When this conversion occurs it indeed does seems to do something with video somewhere - i don't have explanation for this except black magic. From what I can see in Jellyfin server logs it just direct stream (copy) video , transcode audio to ac3 (-codec:a:0 ac -ac 6 -ab 640000) a send it. This is especially jarring when using/changing subtitles. Maybe problem on Wholphin side?

Also I managed to break this fix entirely when transcoded video started playing, i changed audio to basic AC3 track in another language and activated subtitles there - then returned audio to original AAC track and activated subtitles ... AAC collapsed to PCM 2.0 and video no longer transcoded :D

Kinda wondering if the changes in DeviceProfileUtils.kt would not be the culprit.

@damontecres

Copy link
Copy Markdown
Owner Author

do something with video somewhere [..] jarring when using/changing subtitles

What do you mean? Like the video is glitching?

then returned audio to original AAC track and activated subtitles ... AAC collapsed to PCM 2.0 and video no longer transcoded

Oh yeah. There's some special logic when switching tracks if direct play is occurring. It will bypass using the device profile to check with the server if the newly selected tracks are direct playable from ExoPlayer's perspective. Not sure if I explained that well enough, but I know where to fix this in the code.

@nitram3

nitram3 commented Mar 2, 2026

Copy link
Copy Markdown

I'm very interested in this PR, since I have a S/PDIF connection with my receiver. And I currently can't use Wholphin because of this.
But am I understanding this right?

An downside of enabling this is that embedded subtitles be burned in causing a video transcode as well.

I either won't be able to use subtitles or videos will always be transcoded together with audio?

@damontecres

Copy link
Copy Markdown
Owner Author

I either won't be able to use subtitles or videos will always be transcoded together with audio?

If the audio is being transcoded, then if you enable an embedded subtitle track, it will switch the video to transcode as well in order to burn-in the subtitles.

But, I still need to investigate a bit more because I believe this situation happens because the transcoded stream is .ts container which has more limited subtitle options. Potentially using fmp4 (see #686) might not require burning in the subtitles.

@nitram3

nitram3 commented Mar 4, 2026

Copy link
Copy Markdown

I see. Thanks for explaining!

@n8llcaster

Copy link
Copy Markdown

What do you mean? Like the video is glitching?

Just annoying waiting time every time you change something because of the transcode issue. Sorry for confusion :)

@damontecres

Copy link
Copy Markdown
Owner Author

then returned audio to original AAC track and activated subtitles ... AAC collapsed to PCM 2.0 and video no longer transcoded

@n8llcaster The latest commit, 5d6b8ff, should fix this now.

I'll eventually need to figure out a better, more generalized way to handle this type of "unsupported" track, but for now, this should work.

@hdanielhfv

Copy link
Copy Markdown

First of all, thanks to the creators of WHOLPHIN for the best app I've tried for Jellyfin 👍

​I tried everything to transcode OPUS 5.1 and AAC 5.1 on Smart TVs (Android TV, LG webOS, and Samsung Tizen) to use the SPDIF and HDMI ARC outputs. On Android, the only external players that worked were Kodi and Vimu Media Player.
​However, I don’t like using external players, and this solution obviously excludes Samsung and LG.
​The best solution I found to save space—especially when you have thousands of videos and want to avoid bloating your storage—was to use official E-AC3 (not ffmpeg). It is the only format that is backwards compatible with older receivers and soundbars that only support AC3.
​Samsung, LG, and Google TV take the DD+ (E-AC3) signal and transcode it on the fly to DD (AC3).

​I installed the experimental WHOLPHIN version and enabled AC3 transcoding, but it didn't work on my Smart TV running Google TV 12.

darkflame91 added a commit to darkflame91/Wholphin that referenced this pull request May 18, 2026
This change forces all multichannel audio to be transcoded to AC3 5.1.
This is meant for TV's/devices that support SPDIF and/or ARC, but not
eARC. Therefore they are limited to 6 channels and the AC3 codec (many
such devices support DTS codec as well, but not as universally as AC3).
However, they frequently advertise support for more channels and newer
codecs, silently downmixing such audio streams internally. This change
ensures that the client can still output multichannel audio that is
compatible with the device.
This change does not force video transcode, or alter existing video
stream transcoding behavior.

This change primarily:
1. Adds a toggle to enable this mode.
2. Manages potentially conflicting 'Downmix to Stereo' and 'AC3
Supported' toggles.
3. For video libraries, if toggle is enabled, sets max channels to 6
and invalidates all non-AC3 codecs for multichannel audio.
4. For music libraries, if toggle is enabled, sets max channels to 6
and requests transcode to AC3 in mka container for multichannel audio.

Similar to Experimental PR damontecres#947.

1. UT's added to validate and prevent potential toggle conflicts.
2. Manually tested on Firestick 4k (1st gen) in video+audio libraries:
   - Stereo audio content plays with DirectPlay
   - Multichannel AC3 content plays with DirectPlay
   - Multichannel non-AC3 content plays with DirectStream

N/A

LLM's were used for planning, initial draft and critical review.
All code changes were manually reviewed and vetted.
@Kawalskint

Kawalskint commented Jun 28, 2026

Copy link
Copy Markdown

I tested the develop/ac3-test build v1.0.1-18-g57203117 on an Amazon Fire TV Stick and can confirm it fixes the multichannel AAC issue for my setup. Previously, AAC 5.1 audio was DirectPlayed, resulting in stereo/PCM output.

With the develop/ac3-test build and "Use AC3 for surround sound audio" enabled:

  • AAC 5.1 is transcoded to AC3 5.1.
  • Video remains Direct Play (only the audio is transcoded).
  • My AV receiver now correctly receives Dolby Digital 5.1.
  • EAC3/DD+ content continues to Direct Play correctly.

The debug overlay confirms::

  • Play method: Transcode
  • Video Direct: true
  • Audio: ac3, ch=6
  • Audio Direct: false
  • Reason: AudioCodecNotSupported / AudioProfileNotSupported

This is exactly the behaviour I was hoping for. Thank you for implementing this feature. I hope it can be merged into the main release, as I think it will benefit many Fire TV and Android TV users with ARC/eARC or SPDIF audio setups.

One question, is this feature planned to be merged into the main develop branch, or should Fire TV users continue using the develop/ac3-test build for now?

For anyone else testing the same issue for now, this is the v1.0.1-18-g57203117 build I used: https://github.com/damontecres/Wholphin/releases/tag/develop-ac3-test

@damontecres damontecres changed the title Experiment: Option to transcode surround sound audio to AC3 Experimental option to transcode surround sound audio to AC3 Jun 28, 2026
Includes changes for transcoding music & other audio formats beyond AAC/Opus

Co-authored-by: darkflame91 <darkflame91@gmail.com>
@damontecres
damontecres marked this pull request as ready for review June 28, 2026 20:02
@damontecres

Copy link
Copy Markdown
Owner Author

I've moved this to be an experimental feature and incorporated some changes from #1410.

I need to test a bit more, but I am planning to merge this into main!

@darkflame91

darkflame91 commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

@damontecres thanks for incorporating my changes.

I went into a rabbit hole looking into the PGS subtitle issue - I built a (wonky!) POC to support PGS subtitles sent by Jellyfin as external SUP files : darkflame91@f122561

However, I was also looking into device side transcoding, and I've raised PR's for it (damontecres/wholphin-extensions#10 and #1642)
I think this would be a better solution for #255 as it completely side-steps the issues with server-side transcoding.

@Kawalskint

Kawalskint commented Jul 8, 2026

Copy link
Copy Markdown

I updated from v1.0.1-18-g57203117 to v1.0.2-28-g33bab6e4 on the develop/ac3-test branch. The "Use AC3 for surround sound audio" setting is no longer present,

On the earlier build, enabling this option successfully transcoded AAC 5.1 audio to AC3 5.1 while keeping the video direct. On v1.0.2-28-g33bab6e4, AAC 5.1 audio is once again DirectPlayed, so my AV receiver only receives stereo/PCM.

Was the option intentionally removed, moved elsewhere, or is this a regression?

Unfortunately, I can no longer locate v1.0.1-18-g57203117 to download it again for comparison.

1

@damontecres

Copy link
Copy Markdown
Owner Author

Was the option intentionally removed, moved elsewhere, or is this a regression?

It's now in experimental settings

@damontecres
damontecres merged commit d481aea into main Jul 9, 2026
3 checks passed
@damontecres
damontecres deleted the develop/ac3-test branch July 9, 2026 17:15
damontecres added a commit that referenced this pull request Jul 14, 2026
## Description
Fixes [compile
error](https://github.com/damontecres/Wholphin/actions/runs/29357259594/job/87167912698)

### Related issues
Resulted from merging #947 & #1680 together into main

### Testing
Compiled & unit tests

## Screenshots
N/A

## AI or LLM usage
None
@n8llcaster

n8llcaster commented Jul 24, 2026

Copy link
Copy Markdown

Tested experimental setting in v1.0.3-22-gcf3c00a1 and it works as it should! Good job!

Only weird bug i noticed is that i managed to break SRT entirely when changing audios and it wasn't showing SRT subtitles at all in any medium I tried. PGS/SUB and other "picture" subtitle formats are working... but SRT is not working anymore anywhere, even after force kill of an app :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request playback Related to media playback

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] - AAC 6/8-channel audio only outputs as Stereo PCM

6 participants